export { BaseModel } from './BaseModel';
export { Character, CharacterAttributes } from './Character';
export { User, UserAttributes } from './User';
export { ChatMessage, ChatMessageAttributes } from './ChatMessage';
export { UserCharacterRelation, UserCharacterRelationAttributes } from './UserCharacterRelation';

// 创建模型实例
import { Character as CharacterModel } from './Character';
import { User as UserModel } from './User';
import { ChatMessage as ChatMessageModel } from './ChatMessage';
import { UserCharacterRelation as UserCharacterRelationModel } from './UserCharacterRelation';
import pool from '../config/database';

export const models = {
  character: new CharacterModel(),
  user: new UserModel(),
  chatMessage: new ChatMessageModel(),
  userCharacterRelation: new UserCharacterRelationModel()
};

// 导出数据库连接池以供其他模块使用
export const db = pool;

// 类型定义
export type ModelName = keyof typeof models;
export type ModelInstance = typeof models[ModelName];

// 数据库模型初始化函数
export async function initializeModels(): Promise<void> {
  // 这里可以添加模型初始化逻辑，如创建表、索引等
  console.log('Database models initialized successfully');
}